home *** CD-ROM | disk | FTP | other *** search
/ Enter 2010 January / ENTER_2010_01.iso / Programy / Gry / Base_Invaders_ / BaseInvadersSetup1.3.exe / {app} / Scripts / Campaign5Startup.lua < prev    next >
Encoding:
Text File  |  2007-01-25  |  5.8 KB  |  230 lines

  1. function NinjaCinematic()
  2.  
  3.     Camera.CinemaMove( Vector3(170,15,170), Vector3(170,0,130), 2 );
  4.  
  5.     GameWait(2)
  6.  
  7.     TraitorTalk( "It's Quiet. Shh!  Did you hear that?" );
  8.     Camera.CinemaMove( Vector3(170,15,170), Vector3(126,0,170), 5 );
  9.     GameWait(4)
  10.  
  11.     G.CreateAt( "Ninja", Vector3( 125, 0, 125 ) );
  12.     GameWait(0.25)
  13.     G.CreateAt( "Ninja", Vector3( 130, 0, 125 ) );
  14.     G.CreateAt( "Ninja", Vector3( 125, 0, 130 ) );
  15.     Camera.CinemaMove( Vector3(170,15,170), Vector3(130,0,130), 0.5 );
  16.     GameWait(0.5)
  17.     G.CreateAt( "Ninja", Vector3( 135, 0, 125 ) );
  18.     G.CreateAt( "Ninja", Vector3( 125, 0, 135 ) );
  19.     GameWait(0.25)
  20.  
  21.     TraitorTalk( "AHH! Ninjas!" );
  22.     GameWait(3)
  23.     
  24. end
  25.  
  26. --Common Level Start Code
  27. function LevelStartup()
  28.  
  29.     G.Create( "MenuData/HudCog.xml" );
  30.     G.Create( "Data/GameCamera.xml" );
  31.     G.Create( "Data/CursorCog.xml" );
  32.  
  33.     MainLevel = G.Create( "Data/Levels/Campaign5.xml" );
  34.     MainLevel.CreateLevel();
  35.  
  36.     G.SetInvSpeed( 20 );
  37.     HUD.EnterLevel();
  38.     G.SetGameState( InLevel );
  39.     
  40.     G.SetMaxKills(0)
  41.     G.SetPoints( 0 );
  42.  
  43.     G.SetLightTime( 1 );
  44.     G.PostP( "Glare" );
  45.     
  46.     -- gameStartTime = 10000000;
  47.  
  48.     HUD.Message( "VictoryCondition" , "SetText", "Negate the Ninja Invasion!"  );
  49.     HUD.Message( "LossCondition" , "SetText", "If the Tower falls you lose." );
  50.         
  51.     TraitorCanBeHidden = true
  52.     --TraitorTalk(" ");
  53. end
  54.  
  55. LevelStartup()
  56.  
  57. function LevelIntro()
  58.     
  59.     local tempPos = Tower.GetPosition()
  60.     Camera.LookAtPosition( tempPos )
  61.  
  62.     gameStartTime = GameTime;
  63.  
  64.     --ColorTextPopup( "Level 5: A Knife In The Shadows", Color(1,1,1,1) )
  65.     ColorTextPopup( "Level 5: Shadow's Knife", Color(1,1,1,1) )
  66.     --ColorTextPopup( "Level 5: Shades of Steel", Color(1,1,1,1) )
  67.  
  68.     G.DisableTrapAll()
  69.         
  70.     G.EnableTrap("wall");
  71.     G.EnableTrap("bomb");
  72.     G.EnableTrap("laser");
  73.     G.EnableTrap("fan");
  74.  
  75.     DisableTraitor()
  76.     GameWait(1.5)
  77.     
  78.     TraitorTalk("Shh!  I woke you up because I heard someone sneaking around.")
  79.     GameWait(5)
  80.     TraitorTalk("I set up some flash bulb traps really quickly, but I dont know if it'll be enough.  Here are the blueprints...")
  81.     GameWait(5)
  82.     TrapTextPopup("Flash Bulb")    
  83.     G.EnableTrap("bulb");
  84.     GameWait(5)
  85.     TraitorTalk("Flash Bulb traps will provide some light, and temporarily blind any nearby invaders.")
  86.     GameWait(7)
  87. --    TraitorTalk("Shh!  Did you hear that?  I think someone's here!");
  88. --    GameWait(5);
  89.  
  90.     StartCinematic();
  91.         NinjaCinematic()
  92.     EndCinematic();
  93.  
  94.     DisableTraitor()
  95. end
  96.  
  97. function LevelSequence()    
  98.     -- Start Spawning the guys
  99.     NinjaWave = createSpawnStruct()
  100.     
  101.     NinjaWave.Prob.Ninja    = 1.0;
  102.     
  103.     NinjaWave.SpawnSpeed    = 3.0;
  104.     NinjaWave.MaxSpawn        = 20;
  105.     NinjaWave.TotalSpawn    = 5;
  106.     NinjaWave.GroupPercent    = 0.15;
  107.     NinjaWave.GroupSize        = 1;
  108.     NinjaWave.WhereToSpawn    = CircleAroundTower
  109.     
  110.     MainWave = createSpawnStruct()
  111.     
  112.     MainWave.Prob.Basic        = 3.0;
  113.     MainWave.Prob.Miner        = 2.0;
  114.     MainWave.Prob.Driller    = 1.0;
  115.     MainWave.Prob.Ninja        = 5.0;
  116.     
  117.     MainWave.SpawnSpeed        = 1.5;
  118.     MainWave.MaxSpawn        = 25;
  119.     MainWave.TotalSpawn        = 45;
  120.     MainWave.GroupPercent    = 0.15;
  121.     MainWave.GroupSize        = 1;
  122.     MainWave.WhereToSpawn    = CircleAroundTower
  123.     
  124.     AmbushWave = createSpawnStruct()
  125.         
  126.     AmbushWave.Prob.Kamikaze    = 5.0;
  127.     AmbushWave.Prob.Ninja        = 5.0;
  128.     
  129.     AmbushWave.SpawnSpeed        = 2.0;
  130.     AmbushWave.MaxSpawn            = 25;
  131.     AmbushWave.TotalSpawn        = 50;
  132.     AmbushWave.GroupPercent        = 0.15;
  133.     AmbushWave.GroupSize        = 1;
  134.     AmbushWave.WhereToSpawn        = CircleAroundTower
  135.     
  136.     
  137.     InvaderTextPopup( "Ninja" );
  138.     GameWait(3)
  139.     
  140.     AddWave( "NinjaAttack", NinjaWave )
  141.     G.SetMaxKills(10);
  142.     GameWait(3)
  143.     
  144.     WaitForClearEnemies( )
  145.     
  146.     TraitorTalk("Wow, ninjas!  They're so cool!")
  147.     GameWait(5)
  148.     TraitorTalk("Er, I mean...  stupid ninjas, attacking at night.")
  149.     GameWait(6)
  150.     TraitorTalk("They're extremely fast, and as you saw, they can also jump over walls.")
  151.     GameWait(6)
  152.     --TraitorTalk("Here, I've got something else for you.  Its a giant Bug Zapper trap.  It does major damage to anyone close by.");
  153.     --GameWait(3)
  154.     --ColorTextPopup( "New Trap: Bug Zapper!", Color(0,0,0.85,1) )
  155.     --G.EnableTrap("zapper");
  156.     --GameWait(7);
  157.     TraitorTalk("Build up some defenses, I bet more will be coming soon.                          *Yawn*  I'm tired...  I'm gonna go take a nap.");
  158.     GameWait(3)
  159.     G.EarnPoints( 300 );
  160.     GameWaitOrMoney(25)
  161.     
  162.     NinjaWave.TotalSpawn    = 30;
  163.     G.SetMaxKills(40);
  164.     GameWait(3)
  165.     
  166.     WaitForClearEnemies( )
  167.     --AddWave( "MainAttack", MainWave )
  168.     --G.SetMaxKills(80);
  169.     
  170.     --WaitForTimeOrKills( 500, 80 )
  171.     --StopWave( "MainAttack" )
  172.     
  173.     TraitorTalk("Wow... that was brutal.  I'll go see if we have anything else to throw at them.")
  174.     GameWait(7)
  175.     TraitorTalk("Ah!! Here we go!  Blueprints for a Flame Turret.")
  176.     GameWait(6)    
  177.         
  178.     TrapTextPopup("Flame Turret")    
  179.     G.EarnPoints( 150 )
  180.     G.EnableTrap("flame");
  181.     GameWait(3)    
  182.     
  183.     TraitorTalk("Any invader who gets too close will be set aflame.")
  184.     GameWait(5)
  185.     TraitorTalk("And as an added bonus, anyone who touches a burning invader ignites as well.")
  186.     GameWait(7)
  187.     TraitorTalk("We invaders are quite flammable that way...")
  188.     GameWait(5)
  189.     TraitorTalk("Just be sure to keep those things away from me!")
  190.     GameWait(5)
  191.     
  192.     MainWave.TotalSpawn = 75;
  193.     AddWave( "MainAttack", MainWave )
  194.     G.SetMaxKills(115);
  195.     InvadersKilledWait(115);
  196.     StopWave( "MainAttack" )
  197.     
  198.     GameWait(5)
  199.     TraitorTalk("Wait, this seemed too easy ...")
  200.     GameWait(7)
  201.     TraitorTalk("Beef up the defenses just in case.")
  202.     GameWaitOrMoney(15)
  203.     
  204.     AddWave( "AmbushAttack", AmbushWave )
  205.     G.SetMaxKills(165)
  206.  
  207.     TraitorTalk("Ahhhh!! Look out!!!")
  208.     GameWait(5)
  209.     
  210.     InvadersKilledWait(165);
  211.     StopWave( "AmbushAttack" )
  212.     GameWait(3)
  213.     
  214.     TraitorTalk("*huff* *huff* Whew! That was close, but we made it!  You rock!")
  215.     GameWait(7)
  216.  
  217.     G.SetGameState( Victory );
  218.     
  219.     TraitorTalk("I wonder what tomorrow will bring...");
  220.     GameWait(3)
  221.         
  222. --    G.SetGameState( Victory );
  223.     
  224. end
  225.  
  226.  
  227. levelRoutine = coroutine.create(LevelIntro);
  228.  
  229. GMain["LevelUpdate"] = LevelUpdate;
  230.